package myJs.myPkg.reactDraggable

import japgolly.scalajs.react.CtorType.ChildArg
import japgolly.scalajs.react.vdom.{VdomElement, VdomNode}
import japgolly.scalajs.react.{Children, JsComponent}
import org.scalajs.dom.{Event, html}
import slinky.readwrite._

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.|
import scala.concurrent.Future

/** Created by yz on 14/10/2022
  */
object Draggable {
  case class Props(
      handle: js.UndefOr[String] = js.undefined
  )

  @js.native
  @JSImport("react-draggable", JSImport.Default)
  object RawComponent extends js.Object {}

  val Component = JsComponent[ObjectOrWritten[Props], Children.Varargs, Null](RawComponent)

  def apply(
      handle: js.UndefOr[String] = js.undefined
  )(children: ChildArg*):VdomElement = {
    Component(Props(handle))(children: _*)
  }

}
